/* Accordion Container */
.alpi-cms-content-accordion {
    width: 100%;
    background-color: var(--color-white);
    padding-top: var(--alpi-accordion-padding-top-desktop, 0);
    padding-bottom: var(--alpi-accordion-padding-bottom-desktop, 0);
    margin-top: var(--alpi-accordion-margin-top-desktop, 0);
    margin-bottom: var(--alpi-accordion-margin-bottom-desktop, 0);
}

/* Accordion Section */
.alpi-cms-content-accordion-section {
    margin-bottom: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--color-white);
}

.alpi-cms-content-accordion-section:last-child {
    margin-bottom: 0;
}

/* Accordion Header */
.alpi-cms-content-accordion-header {
    margin: 0;
    padding: 0;
}

/* Accordion Trigger (Button) */
.alpi-cms-content-accordion-trigger {
    width: 100%;
    padding: 20px;
    background-color: var(--color-white);
    border: none;
    text-align: left;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 500;
    color: var(--color-dark);
    transition: background-color 0.3s ease;
}

.alpi-cms-content-accordion-trigger:after {
    content: '';
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 16px;
}

.alpi-cms-content-accordion-trigger[aria-expanded="true"]:after {
    transform: rotate(-135deg) translateY(2px);
}

.alpi-cms-content-accordion-trigger:hover {
    background-color: #f8f9fa;
}

.alpi-cms-content-accordion-trigger:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* Accordion Content */
.alpi-cms-content-accordion-content {
    overflow: hidden;
    will-change: max-height;
}

.alpi-cms-content-accordion-content[hidden] {
    display: none;
}

/* Content Inner */
.alpi-cms-content-accordion-content-inner {
    padding: 20px;
    color: var(--color-dark);
    font-size: 16px;
    line-height: 1.6;
}

/* 4K screens (≥2560px) */
@media screen and (min-width: 2560px) {
    .alpi-cms-content-accordion {
        padding-top: var(--alpi-accordion-padding-top-desktop, 0);
        padding-bottom: var(--alpi-accordion-padding-bottom-desktop, 0);
        margin-top: var(--alpi-accordion-margin-top-desktop, 0);
        margin-bottom: var(--alpi-accordion-margin-bottom-desktop, 0);
    }

    .alpi-cms-content-accordion-trigger {
        padding: 32px;
        font-size: 24px;
    }

    .alpi-cms-content-accordion-content-inner {
        padding: 32px;
        font-size: 20px;
    }

    .alpi-cms-content-accordion-trigger:after {
        width: 14px;
        height: 14px;
        margin-left: 20px;
    }

    .alpi-cms-content-accordion-section {
        margin-bottom: 24px;
        border-radius: 12px;
    }
}

/* Desktop screens (1200px to 2559px) */
@media screen and (min-width: 1200px) and (max-width: 2559px) {
    .alpi-cms-content-accordion {
        padding-top: var(--alpi-accordion-padding-top-desktop, 0);
        padding-bottom: var(--alpi-accordion-padding-bottom-desktop, 0);
        margin-top: var(--alpi-accordion-margin-top-desktop, 0);
        margin-bottom: var(--alpi-accordion-margin-bottom-desktop, 0);
    }

    .alpi-cms-content-accordion-trigger {
        padding: 24px;
        font-size: 20px;
    }

    .alpi-cms-content-accordion-content-inner {
        padding: 24px;
        font-size: 18px;
    }

    .alpi-cms-content-accordion-trigger:after {
        width: 12px;
        height: 12px;
        margin-left: 18px;
    }
}

/* Tablet screens (768px to 1199px) */
@media screen and (min-width: 768px) and (max-width: 1199px) {
    .alpi-cms-content-accordion {
        padding-top: var(--alpi-accordion-padding-top-tablet, var(--alpi-accordion-padding-top-desktop, 0));
        padding-bottom: var(--alpi-accordion-padding-bottom-tablet, var(--alpi-accordion-padding-bottom-desktop, 0));
        margin-top: var(--alpi-accordion-margin-top-tablet, var(--alpi-accordion-margin-top-desktop, 0));
        margin-bottom: var(--alpi-accordion-margin-bottom-tablet, var(--alpi-accordion-margin-bottom-desktop, 0));
    }

    .alpi-cms-content-accordion-trigger {
        padding: 20px;
        font-size: 17px;
    }

    .alpi-cms-content-accordion-content-inner {
        padding: 20px;
        font-size: 16px;
    }

    .alpi-cms-content-accordion-trigger:after {
        width: 10px;
        height: 10px;
        margin-left: 16px;
    }
}

/* Mobile screens (481px to 767px) */
@media screen and (min-width: 481px) and (max-width: 767px) {
    .alpi-cms-content-accordion {
        padding-top: var(--alpi-accordion-padding-top-mobile, var(--alpi-accordion-padding-top-tablet, 0));
        padding-bottom: var(--alpi-accordion-padding-bottom-mobile, var(--alpi-accordion-padding-bottom-tablet, 0));
        margin-top: var(--alpi-accordion-margin-top-mobile, var(--alpi-accordion-margin-top-tablet, 0));
        margin-bottom: var(--alpi-accordion-margin-bottom-mobile, var(--alpi-accordion-margin-bottom-tablet, 0));
    }

    .alpi-cms-content-accordion-section {
        margin-bottom: 12px;
        border-radius: 6px;
    }

    .alpi-cms-content-accordion-trigger {
        padding: 16px;
        font-size: 16px;
    }

    .alpi-cms-content-accordion-content-inner {
        padding: 16px;
        font-size: 14px;
    }

    .alpi-cms-content-accordion-trigger:after {
        width: 9px;
        height: 9px;
        margin-left: 14px;
    }
}

/* Small mobile screens (≤480px) */
@media screen and (max-width: 480px) {
    .alpi-cms-content-accordion {
        padding-top: var(--alpi-accordion-padding-top-mobile, 0);
        padding-bottom: var(--alpi-accordion-padding-bottom-mobile, 0);
        margin-top: var(--alpi-accordion-margin-top-mobile, 0);
        margin-bottom: var(--alpi-accordion-margin-bottom-mobile, 0);
    }

    .alpi-cms-content-accordion-section {
        margin-bottom: 10px;
        border-radius: 4px;
    }

    .alpi-cms-content-accordion-trigger {
        padding: 14px;
        font-size: 15px;
    }

    .alpi-cms-content-accordion-content-inner {
        padding: 14px;
        font-size: 13px;
    }

    .alpi-cms-content-accordion-trigger:after {
        width: 8px;
        height: 8px;
        margin-left: 12px;
    }
}

/* Accordion Accessibility Enhancements */
/* Increased contrast mode */
@media (prefers-contrast: more) {
    .alpi-cms-content-accordion-trigger {
        border: 2px solid currentColor;
    }

    .alpi-cms-content-accordion-trigger[aria-expanded="true"] {
        background-color: var(--color-primary);
        color: var(--color-white);
    }
}

/* Print styles for accordion */
@media print {
    .alpi-cms-content-accordion-content {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .alpi-cms-content-accordion-trigger {
        display: none;
    }

    .alpi-cms-content-accordion-section {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #000;
        margin-bottom: 20px;
    }

    .alpi-cms-content-accordion-content-inner {
        padding: 15px;
    }
}

/* Windows High Contrast Mode */
@media (forced-colors: active) {
    .alpi-cms-content-accordion-trigger {
        border: 1px solid ButtonBorder;
        background-color: ButtonFace;
        color: ButtonText;
        forced-color-adjust: none;
    }

    .alpi-cms-content-accordion-trigger:hover,
    .alpi-cms-content-accordion-trigger:focus {
        border-color: Highlight;
    }

    .alpi-cms-content-accordion-trigger[aria-expanded="true"] {
        background-color: Highlight;
        color: HighlightText;
    }

    .alpi-cms-content-accordion-section {
        border-color: ButtonBorder;
    }
}

/* Screen reader only text for accordion */
.alpi-cms-content-accordion .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible polyfill support */
.alpi-cms-content-accordion-trigger:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: none;
}